using UniversalAdmin.Shared.Enums;

namespace UniversalAdmin.Domain.Entities;

public class Article : BaseEntity
{
    public string Title { get; set; } = string.Empty;
    public string Content { get; set; } = string.Empty;
    public string? Summary { get; set; }
    public string? CoverImage { get; set; }
    public ArticleStatus Status { get; set; } = ArticleStatus.Draft;
    public Guid CategoryId { get; set; }
    public string? Tags { get; set; }
    public int ViewCount { get; set; } = 0;
    public Guid AuthorId { get; set; }
    public DateTime? PublishedAt { get; set; }

    // 导航属性
    public virtual ArticleCategory Category { get; set; } = null!;
    public virtual User Author { get; set; } = null!;
}

public class ArticleCategory : BaseEntity
{
    public string Name { get; set; } = string.Empty;
    public string? Description { get; set; }
    public Guid? ParentId { get; set; }
    public int SortOrder { get; set; } = 0;

    // 导航属性
    public virtual ICollection<Article> Articles { get; set; } = new List<Article>();
    public virtual ArticleCategory? Parent { get; set; }
    public virtual ICollection<ArticleCategory> Children { get; set; } = new List<ArticleCategory>();
}